{% extends "base.html" %}

{% block title %}管理员登录 - Ruiyun Cloud{% endblock %}

{% block content %}
<div class="login-page">
    <div class="login-container">
        <div class="login-header">
            <h1>🔐 管理员登录</h1>
            <p>请使用管理员账号登录</p>
        </div>

        <form method="POST" action="{{ url_for('admin.login') }}" class="login-form">
            <div class="form-group">
                <label for="username">用户名</label>
                <input
                    type="text"
                    id="username"
                    name="username"
                    class="form-control"
                    placeholder="请输入用户名"
                    required
                    autofocus
                >
            </div>

            <div class="form-group">
                <label for="password">密码</label>
                <input
                    type="password"
                    id="password"
                    name="password"
                    class="form-control"
                    placeholder="请输入密码"
                    required
                >
            </div>

            <button type="submit" class="btn btn-primary btn-block">
                登录
            </button>
        </form>

        <div class="login-footer">
            <a href="{{ url_for('public.index') }}" class="link-secondary">
                ← 返回首页
            </a>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_css %}
<style>
    .login-page {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: calc(100vh - 200px);
        padding: 2rem 0;
    }

    .login-container {
        background: white;
        padding: 3rem;
        border-radius: 10px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        width: 100%;
        max-width: 400px;
    }

    .login-header {
        text-align: center;
        margin-bottom: 2rem;
    }

    .login-header h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
        color: #333;
    }

    .login-header p {
        color: #666;
        font-size: 0.95rem;
    }

    .login-form .form-group {
        margin-bottom: 1.5rem;
    }

    .login-form label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        color: #333;
    }

    .login-form .form-control {
        width: 100%;
        padding: 0.75rem 1rem;
        border: 1px solid #ddd;
        border-radius: 5px;
        font-size: 1rem;
        transition: border-color 0.3s, box-shadow 0.3s;
    }

    .login-form .form-control:focus {
        outline: none;
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

    .login-footer {
        text-align: center;
        margin-top: 1.5rem;
    }

    .link-secondary {
        color: #666;
        text-decoration: none;
        font-size: 0.9rem;
        transition: color 0.3s;
    }

    .link-secondary:hover {
        color: #667eea;
    }
</style>
{% endblock %}
